/* 欧拉函数
* 1.线性筛(欧拉筛) 欧拉函数phi(n)表示小于或等于n的正整数中与n互质的数的数目
    const int N = 1e9;
    int primes[N], cnt;
    bool st[N];
    int phi[N];

    void init(int n)
    {
        phi[1] = 1;
        for(int i = 2; i <= n; i++){
            if(!st[i]) { 
                primes[cnt++] = i;
                phi[i] = i-1;
                }
            for(int j = 0; primes[j]*i <= n; j++)
            {
                st[primes[j]*i] = true;
                if(i % primes[j] == 0) { //可以被整除 -> i包含primes[j]这个质因子, 计算phi不需要额外减去重复的部分
                    phi[i*primes[j]] = phi[i] * (primes[j]);
                    break;      
                }
                //i与primes[j]互质, phi[a*b]=phi[a]*phi[b], 则phi[primes[j]] = primes[j]-1(所有小于当前数的均互质)
                phi[i*primes[j]] = phi[i] * (primes[j] - 1);

            }
        }
    }

* 本题:
    (x, y)互质
*/

#define DEBUG
#pragma GCC optimize("O1,O2,O3,Ofast")
#pragma GCC optimize("no-stack-protector,unroll-loops,fast-math,inline")
#pragma GCC target("avx,avx2,fma")
#pragma GCC target("sse,sse2,sse3,sse4,sse4.1,sse4.2,ssse3")

#include <iostream>
#include <cstring>
#include <algorithm>

using namespace std;

const int N = 1010;
int primes[N], cnt;
bool st[N];
int phi[N];

void init(int n)
{
    phi[1] = 1;
    for(int i = 2; i <= n; i++){
        if(!st[i]) { 
            primes[cnt++] = i;
            phi[i] = i-1;
            }
        for(int j = 0; primes[j]*i <= n; j++)
        {
            st[primes[j]*i] = true;
            if(i % primes[j] == 0) { //可以被整除 -> i包含primes[j]这个质因子, 计算phi不需要额外减去重复的部分
                phi[i*primes[j]] = phi[i] * (primes[j]);
                break;      
            }
            //i与primes[j]互质, phi[a*b]=phi[a]*phi[b], 则phi[primes[j]] = primes[j]-1(所有小于当前数的均互质)
            phi[i*primes[j]] = phi[i] * (primes[j] - 1);

        }
    }
}


int main()
{
    #ifdef DEBUG
        freopen("./in.txt", "r", stdin);
    #else
        ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #endif

    init(N-1);
    int n, m;
    cin >> m;
    for(int T = 1; T <= m; T++)
    {
        cin >> n;
        int res = 1;
        for(int i = 1; i <= n; i++) res += phi[i] * 2;
        cout << T << ' ' << n << ' ' << res << endl;
    }
    return 0;
}